package controllerfxml.spring;
import javax.annotation.Resource;

import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import cn.edu.scau.cmi.luotiansheng.spring.domain.Student;
import cn.edu.scau.cmi.luotiansheng.spring.domain.Teacher;
import cn.edu.scau.cmi.luotiansheng.spring.util.ApplicationContextUtil;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.scene.control.Button;
import javafx.scene.control.TextArea;

public class ViewController {
	ApplicationContext context=ApplicationContextUtil.getApplicationContext();
	
	private Student student=(Student) context.getBean("stu");
	
	private Teacher teacher=(Teacher) context.getBean("tea");
	
	
    @FXML
    private Button btn_stuInfo;

    @FXML
    private TextArea ta_show;

    @FXML
    private Button btn_teaInfo;

    @FXML
    void showStuInfo(ActionEvent event) {
    	String info=student.toString()+"\n";
    	ta_show.appendText(info);
    	
    	
    }

    @FXML
    void ShowTeaInfo(ActionEvent event) {
    	String info=teacher.toString()+"\n";
    	ta_show.appendText(info);
    }

}
